package org.zk.dubbo_consumer.controller;


import com.alibaba.dubbo.config.support.Parameter;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.zk.entity.Broadcast;
import org.zk.entity.Course;
import org.zk.entity.Lession;
import org.zk.entity.LessionBroadcast;
import org.zk.service.BroadcastService;
import org.zk.service.LessionBroadcastService;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 课节表 前端控制器
 * </p>
 *
 * @author Alicelonely
 * @since 2019-12-30
 */
@Controller
@RequestMapping("/lessionBroadcast")
public class LessionBroadcastController {

    @Resource
    private BroadcastService broadcastService;

    @Resource
    private LessionBroadcastService lessionBroadcastService;

    //课程详情页播放视频
    @RequestMapping("/getVideo")
    public ModelAndView getVideo(int lessionBroadcastId) {
        System.out.println (lessionBroadcastId);
        LessionBroadcast lessionBroadcast=lessionBroadcastService.getBroadcastLvideoById (lessionBroadcastId);
        System.out.println (lessionBroadcast.getLessionBroadcastVideo () );
        ModelAndView modelAndView = new ModelAndView("teacher/teacherconter/luboplay");
        modelAndView.addObject("lessionBroadcast",lessionBroadcast);
        return modelAndView;
    }


    //课程详情页播放视频
    @RequestMapping("/getBroadcastVideo")
    public ModelAndView getVideo(int lessionBroadcastId, Broadcast broadcast) {
        System.out.println(broadcast.getBroadcastId());
        System.out.println(lessionBroadcastId);
        Broadcast broadcast1 = broadcastService.getBroadcastById(broadcast.getBroadcastId());
        List<LessionBroadcast> lessionBroadcastList = lessionBroadcastService.getBroadcastLessionById(broadcast.getBroadcastId());
        ModelAndView modelAndView = new ModelAndView("user/broadcastPlay");
        modelAndView.addObject("lessionBroadcastList", lessionBroadcastList);
        modelAndView.addObject("broadcast",broadcast1);
        return modelAndView;
    }

}

